/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023.
 * Description: support no devmem
 * Author: Abbott Liu <liuwenliang@huawei.com>
 * Create: 2023-09-05
 */
#include <linux/hal/linear.h>
#include <linux/irq.h>
#include <linux/numa.h>
#include <linux/atomic.h>

#ifdef CONFIG_RTOS_HAL_LINEAR_MAP
#include <linux/hal/irq-mbigen.h>
#endif

#include "internal_linear.h"

#ifdef CONFIG_RTOS_HAL_LINEAR_MAP

static irq_domain_find_parent_t irq_domain_find_hwirq_parent;

void set_irq_domain_find_parent(irq_domain_find_parent_t find_hwirq_parent)
{
	irq_domain_find_hwirq_parent = find_hwirq_parent;
}

irq_domain_find_parent_t get_irq_domain_find_parent(void)
{
	return irq_domain_find_hwirq_parent;
}

#ifdef CONFIG_GENERIC_MSI_IRQ
static atomic_t msi_irq_base = ATOMIC_INIT(MSI_IRQ_BASE);
int get_msi_irq_base(void)
{
	return atomic_read(&msi_irq_base);
}

void add_msi_irq_base(unsigned int num)
{
	atomic_add(num, &msi_irq_base);
}

#endif

#endif	/* CONFIG_RTOS_HAL_LINEAR_MAP */
